package com.tyc.mb.common.util;

import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.util.DigestUtils;

/**
 * 类描述
 *
 * @author tyc
 * @version 1.0
 * @date 2021-10-28 15:43:25
 */
public class MD5BCrypt {
    public static void main(String[] args) {
        String password = "123456";
        System.out.println(DigestUtils.md5DigestAsHex(password.getBytes()));
        System.out.println(DigestUtils.md5DigestAsHex(password.getBytes()));

        BCryptPasswordEncoder bCryptPasswordEncoder = new BCryptPasswordEncoder();
        String encode = bCryptPasswordEncoder.encode(password);
        String encode1 = bCryptPasswordEncoder.encode(password);
        System.out.println(encode);
        System.out.println(encode1);
        System.out.println(bCryptPasswordEncoder.matches(password,encode));
        System.out.println(bCryptPasswordEncoder.matches(password,encode1));
    }
}
